fileformatsfandomcom-20200215-history
JPEG file
JPEG is a lossy image compression file format. It was named after the committee that created the standard, Joint Photographic Experts Group. The JPEG standard specifies both the codec, which defines how an image is compressed into a stream of bytes and decompressed back into an image, and the file format used to contain that stream. Typical usage The JPEG compression algorithm is at its best on photographs and paintings of realistic scenes with smooth variations of tone and color. For web usage, where the bandwidth used by an image is important, JPEG is very popular. Exif is the most common format saved by digital cameras. On the other hand, JPEG is not as well suited for line drawings and other textual or iconic graphics, where the sharp contrasts between adjacent pixels cause noticeable artifacts. Such images are better saved in a lossless graphics format. JPEG is also not well suited to files that will undergo multiple edits, as some image quality will usually be lost each time the image is decompressed and recompressed (generation loss). To avoid this, an image that is being modified or may be modified in the future can be saved in a lossless format such as PNG, and a copy exported as JPEG for distribution. As JPEG is a lossy compression method — it removes information from the image — it must not be used in astronomical or medical imaging or other purposes where the exact reproduction of the data is required. Lossless formats must be used instead. Format Images stored in a JPEG file is lossy (opposite of lossless), that is, some details may be lost over multiple edits to the file. Baseline JPEG loads all of the image in one step. Progressive (interlaced) JPEG is suitable for large images where a blurred image is shown upon initial loading of the file, and as the file is loaded, more details are made visible. The file format is known as JPEG Interchange Format (JIF), as specified in Annex B of the standard. However, this "pure" file format is rarely used, primarily because of the difficulty of programming encoders and decoders that fully implement all aspects of the standard and because of certain shortcomings of the standard: * Color space definition * Component sub-sampling registration * Pixel aspect ratio definition Several additional standards have evolved to address these issues. The first of these, released in 1992, was JPEG File Interchange Format (or JFIF), followed in recent years by Exchangeable image file format (Exif) and ICC color profiles. There is some confusion between the original 'JPEG Interchange Format' (JIF) and the similarly titled 'JPEG File Interchange Format' (JFIF). In some ways JFIF is a cutdown version of the JIF standard in that it specifies certain constraints (such as standard color space), while in other ways it is an extension of JIF due to the standard Application Segment header. The documentation for the original JFIF standard states:http://www.w3.org/Graphics/JPEG/jfif3.pdf JFIF File Format as PDF :JPEG File Interchange Format is a minimal file format which enables JPEG bitstreams to be exchanged between a wide variety of platforms and applications. This minimal format does not include any of the advanced features found in the TIFF JPEG specification or any application specific file format. Nor should it, for the only purpose of this simplified format is to allow the exchange of JPEG compressed images. Image files that employ JPEG compression are commonly called "JPEG files". Most image capture devices (such as digital cameras) and most image editing software programs that write to a "JPEG file" are actually creating a file in the JFIF and/or Exif format.JPEG image compression FAQ. Tom Lane March 29, 1999. (accessed September 11, 2007) (q. 14: "Why all the argument about file formats?") Strictly speaking, the JFIF and Exif standards are incompatible because they each specify that their header appears first. In practice, most JPEG files in Exif format contain a small JFIF header that precedes the Exif header. This allows older readers to correctly handle the older format JFIF header, while newer readers also decode the following Exif header. The most common filename extensions for files employing JPEG compression are .jpg and .jpeg, though .jpe, .jfif and .jif are also used. It is also possible for JPEG data to be embedded in other file types - TIFF encoded files often embed a JPEG image as a thumbnail of the main image. Encoding and decoding Encoding a JPEG file takes the following steps (from JFIF encoding): * Start with a representation of the image, using a color data structure implementation in a matrix. # (Optional step) Transform the image into one using the YCbCr color space. # (Optional step) Reduce the resolution of the chroma components (Cb and Cr). (chroma subsampling/downsampling) # Split the image into blocks of 8×8 pixels. # Perform a discrete cosine transform on each block. To fill up extra space at the borders, dummy pixels are added, usually with black or by repeating the border pixels, to avoid artifacts around the border. # Quantize the amplitudes in the DCT. These are rounded off, which produces the lossy effect of the process. A quantization matrix is used. # Compress the resulting data using entropy encoding. Decoding takes a reverse process. References External links * JPEG Standard (JPEG ISO/IEC 10918-1 ITU-T Recommendation T.81) at W3.org * JFIF File Format at W3.org * Official Joint Photographic Experts Group site Category:Graphics file formats Category:Binary file formats